package logic

import (
	"context"
	"taobao_svc/models/mysql"

	"taobao_svc/internal/svc"
	"taobao_svc/taobao"

	"github.com/zeromicro/go-zero/core/logx"
)

type ProductDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewProductDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProductDelLogic {
	return &ProductDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除商品
func (l *ProductDelLogic) ProductDel(in *taobao.ProductDelRequest) (*taobao.ProductDelResponse, error) {
	// todo: add your logic here and delete this line

	mysql.DB.Debug().Where("id = ?", in.Id).Delete(&mysql.Product{})

	return &taobao.ProductDelResponse{}, nil
}
